<?php

if (isset($_GET["values"]))
{
	$hourid = $_GET["hourid"];
	$values = str_replace("\'", "'", $_GET["values"]);
	
	$QUERY = "
		SELECT plaatsnr
		FROM plaats
		WHERE lokaal IN ($values '')
		AND docentid IN ($values '')
		AND vak IN ($values '')
	";
	//echo "QUERY = $QUERY <br /><br />";
	$RESULT = mysql_query($QUERY) or die('<b style="color: red; font-size: 25px;">Error!</b><br />QUERY:<br />' . $QUERY . '<br /><br />' . mysql_error());
	
	$placenr = mysql_result($RESULT, 0, "plaatsnr");
	
	$QUERY = "
		DELETE FROM plaats
		WHERE plaatsnr = '$placenr'
		";
	//echo "QUERY = $QUERY <br /><br />";
	$RESULT = mysql_query($QUERY) or die('<b style="color: red; font-size: 25px;">Error!</b><br />QUERY:<br />' . $QUERY . '<br /><br />' . mysql_error());
	
	$QUERY = "
		DELETE FROM studieuurplaats (plaatsnr, studieuur) 
		WHERE plaatsnr = '$placenr'
		";
	//echo "QUERY = $QUERY <br /><br />";
	$RESULT = mysql_query($QUERY) or die('<b style="color: red; font-size: 25px;">Error!</b><br />QUERY:<br />' . $QUERY . '<br /><br />' . mysql_error());
	
}

?>